import matplotlib.pyplot as plt
import pandas as pd

# 创建数据
data = {
    'Category': ['Total assets', 'Current assets', 'Non-current assets', 'Total liabilities', 'Current liabilities', 'Non-current liabilities'],
    'End of 2023': [61.79, 32.12, 29.67, 46.76, 32.27, 14.49],
    'End of first half of 2024': [57.06, 30.31, 26.75, 44.58, 31.08, 13.49]
}

# 将数据转换为DataFrame
df = pd.DataFrame(data)

# 设置索引
df.set_index('Category', inplace=True)

# 创建柱状图
df.plot(kind='bar', figsize=(10, 6), rot=0)

# 添加标题和标签
plt.title('Asset and Liability Structure Analysis')
plt.xlabel('Category')
plt.ylabel('Amount (100 million yuan)')

# 显示图例
plt.legend(title='Time')

# 显示网格
plt.grid(True, axis='y')

# 显示图表
plt.show()